<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class unique_any</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../reference_section_of_boost_any.html#doxygen.reference_section_of_boost_any.unique__any_8hpp" title="Header &lt;boost/any/unique_any.hpp&gt;">
<link rel="prev" href="structboost_1_1anys_1_1in__place__type__t.html" title="Struct template in_place_type_t">
<link rel="next" href="unique__any_8hpp_1a082a5eb21c66fc9e1273adfe582943a9.html" title="Global in_place_type">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1anys_1_1in__place__type__t.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference_section_of_boost_any.html#doxygen.reference_section_of_boost_any.unique__any_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="unique__any_8hpp_1a082a5eb21c66fc9e1273adfe582943a9.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class unique_any</span></h2>
<p>boost::anys::unique_any — A class whose instances can hold instances of any type (including non-copyable and non-movable types). </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../reference_section_of_boost_any.html#doxygen.reference_section_of_boost_any.unique__any_8hpp" title="Header &lt;boost/any/unique_any.hpp&gt;">boost/any/unique_any.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>

  <span class="comment">// <a class="link" href="classboost_1_1anys_1_1unique__any.html#id4-bb">public member functions</a></span>
  <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a3af2e3bedd0566353c0c493d78e7ba72"><span class="identifier">unique_any</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a013a65cf6faa8ae172b79b9fe051f27a"><span class="identifier">unique_any</span></a><span class="special">(</span><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1ae0721369c23ba3a180206f1bf26e2d20"><span class="identifier">unique_any</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span><span class="special">,</span> 
               <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">enable_if</span><span class="special">&lt;</span><span class="special">!</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <a class="link" href="classboost_1_1any.html" title="Class any">boost::any</a> <span class="special">&amp;&amp;</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">value</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">*</span> <span class="special">=</span> <span class="keyword">nullptr</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> BoostAny<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1ab846d909ac5fd865422c0763f07b117d"><span class="identifier">unique_any</span></a><span class="special">(</span><span class="identifier">BoostAny</span> <span class="special">&amp;&amp;</span><span class="special">,</span> 
               <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">enable_if</span><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span> <span class="identifier">BoostAny</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <a class="link" href="classboost_1_1any.html" title="Class any">boost::any</a> <span class="special">&amp;&amp;</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">value</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">*</span> <span class="special">=</span> <span class="keyword">nullptr</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
    <span class="keyword">explicit</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a07ea576fc1b9d8b91cc507f7e53f9aa7"><span class="identifier">unique_any</span></a><span class="special">(</span><a class="link" href="structboost_1_1anys_1_1in__place__type__t.html" title="Struct template in_place_type_t">in_place_type_t</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
    <span class="keyword">explicit</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a1e6288f2ed6283b106fadd5d6b70f767"><span class="identifier">unique_any</span></a><span class="special">(</span><a class="link" href="structboost_1_1anys_1_1in__place__type__t.html" title="Struct template in_place_type_t">in_place_type_t</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">U</span> <span class="special">&gt;</span><span class="special">,</span> 
                        <span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a87ccf53a4ea6f56b20030be672604a1a"><span class="special">~</span><span class="identifier">unique_any</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a25ff6be2429c96d6dec220b46a491396"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a9a06d5a7b07834f612fa51c1281d241f"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">decay</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">&amp;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a0bbb56b79260693db0bac0794ece90ea"><span class="identifier">emplace</span></a><span class="special">(</span><span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
    <span class="identifier">std</span><span class="special">::</span><span class="identifier">decay</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">&amp;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a730eb643a6610d09e59e4035ddfcbce6"><span class="identifier">emplace</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">U</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a94df2181e38329fa860da609c898e9f7"><span class="identifier">reset</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a62fc14aec585e78b9688025ce2e430fb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1abaa13d45da8725bd939a44a355f7aa6b"><span class="identifier">has_value</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_info</span> <span class="special">&amp;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a85664c4fb919af6df4f400ea69a503c7"><span class="identifier">type</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.5.6.6.5.4"></a><h2>Description</h2>
<div class="refsect2">
<a name="id-1.3.5.6.6.5.4.2"></a><h3>
<a name="id4-bb"></a><code class="computeroutput">unique_any</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a3af2e3bedd0566353c0c493d78e7ba72"></a><span class="identifier">unique_any</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>this-&gt;<a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1abaa13d45da8725bd939a44a355f7aa6b">has_value()</a> is false. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a013a65cf6faa8ae172b79b9fe051f27a"></a><span class="identifier">unique_any</span><span class="special">(</span><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;&amp;</span> other<span class="special">)</span><span class="special">;</span></pre>
<p>Move constructor that moves content of <code class="computeroutput">other</code> into new instance and leaves <code class="computeroutput">other</code> empty.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>other-&gt;<a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1abaa13d45da8725bd939a44a355f7aa6b">has_value()</a> is false. </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1ae0721369c23ba3a180206f1bf26e2d20"></a><span class="identifier">unique_any</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span> value<span class="special">,</span> 
             <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">enable_if</span><span class="special">&lt;</span><span class="special">!</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <a class="link" href="classboost_1_1any.html" title="Class any">boost::any</a> <span class="special">&amp;&amp;</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">value</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">*</span> <span class="special">=</span> <span class="keyword">nullptr</span><span class="special">)</span><span class="special">;</span></pre>
<p>Forwards <code class="computeroutput">value</code>, so that the content of the new instance has type <code class="computeroutput">std::decay_t&lt;T&gt;</code> and value is the <code class="computeroutput">value</code> before the forward.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. </td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> BoostAny<span class="special">&gt;</span> 
  <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1ab846d909ac5fd865422c0763f07b117d"></a><span class="identifier">unique_any</span><span class="special">(</span><span class="identifier">BoostAny</span> <span class="special">&amp;&amp;</span> value<span class="special">,</span> 
             <span class="keyword">typename</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">enable_if</span><span class="special">&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">is_same</span><span class="special">&lt;</span> <span class="identifier">BoostAny</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <a class="link" href="classboost_1_1any.html" title="Class any">boost::any</a> <span class="special">&amp;&amp;</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">value</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">*</span> <span class="special">=</span> <span class="keyword">nullptr</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Moves the content of <code class="computeroutput"><a class="link" href="classboost_1_1any.html" title="Class any">boost::any</a></code> into *this.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">value.empty()</code> is true. </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
  <span class="keyword">explicit</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a07ea576fc1b9d8b91cc507f7e53f9aa7"></a><span class="identifier">unique_any</span><span class="special">(</span><a class="link" href="structboost_1_1anys_1_1in__place__type__t.html" title="Struct template in_place_type_t">in_place_type_t</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre>
<p>Inplace constructs <code class="computeroutput">T</code> from forwarded <code class="computeroutput">args...</code>, so that the content of <code class="computeroutput">*this</code> is equivalent in type to <code class="computeroutput">std::decay_t&lt;T&gt;</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. </td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
  <span class="keyword">explicit</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a1e6288f2ed6283b106fadd5d6b70f767"></a><span class="identifier">unique_any</span><span class="special">(</span><a class="link" href="structboost_1_1anys_1_1in__place__type__t.html" title="Struct template in_place_type_t">in_place_type_t</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">U</span> <span class="special">&gt;</span> il<span class="special">,</span> 
                      <span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre>
<p>Inplace constructs <code class="computeroutput">T</code> from <code class="computeroutput">li</code> and forwarded <code class="computeroutput">args...</code>, so that the initial content of <code class="computeroutput">*this</code> is equivalent in type to <code class="computeroutput">std::decay_t&lt;T&gt;</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. </td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a87ccf53a4ea6f56b20030be672604a1a"></a><span class="special">~</span><span class="identifier">unique_any</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Releases any and all resources used in management of instance.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a25ff6be2429c96d6dec220b46a491396"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre>
<p>Moves content of <code class="computeroutput">rhs</code> into current instance, discarding previous content, so that the new content is equivalent in both type and value to the content of <code class="computeroutput">rhs</code> before move, or empty if <code class="computeroutput">rhs.empty()</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">rhs-&gt;empty()</code> is true </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a9a06d5a7b07834f612fa51c1281d241f"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><span class="identifier">T</span> <span class="special">&amp;&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre>
<p>Forwards <code class="computeroutput">rhs</code>, discarding previous content, so that the new content of is equivalent in both type and value to <code class="computeroutput">rhs</code> before forward.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety. </td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">decay</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">&amp;</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a0bbb56b79260693db0bac0794ece90ea"></a><span class="identifier">emplace</span><span class="special">(</span><span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre>
<p>Inplace constructs <code class="computeroutput">T</code> from forwarded <code class="computeroutput">args...</code>, discarding previous content, so that the content of <code class="computeroutput">*this</code> is equivalent in type to <code class="computeroutput">std::decay_t&lt;T&gt;</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>reference to the content of <code class="computeroutput">*this</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">class</span><span class="special">...</span> Args<span class="special">&gt;</span> 
  <span class="identifier">std</span><span class="special">::</span><span class="identifier">decay</span><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <span class="special">&amp;</span> 
  <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a730eb643a6610d09e59e4035ddfcbce6"></a><span class="identifier">emplace</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">initializer_list</span><span class="special">&lt;</span> <span class="identifier">U</span> <span class="special">&gt;</span> il<span class="special">,</span> <span class="identifier">Args</span> <span class="special">&amp;&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre>
<p>Inplace constructs <code class="computeroutput">T</code> from <code class="computeroutput">li</code> and forwarded <code class="computeroutput">args...</code>, discarding previous content, so that the content of <code class="computeroutput">*this</code> is equivalent in type to <code class="computeroutput">std::decay_t&lt;T&gt;</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>reference to the content of <code class="computeroutput">*this</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a94df2181e38329fa860da609c898e9f7"></a><span class="identifier">reset</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p>this-&gt;<a class="link" href="classboost_1_1anys_1_1unique__any.html#doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1abaa13d45da8725bd939a44a355f7aa6b">has_value()</a> is false. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a62fc14aec585e78b9688025ce2e430fb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="classboost_1_1anys_1_1unique__any.html" title="Class unique_any">unique_any</a> <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Exchange of the contents of <code class="computeroutput">*this</code> and <code class="computeroutput">rhs</code>.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">*this</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1abaa13d45da8725bd939a44a355f7aa6b"></a><span class="identifier">has_value</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if instance is not empty, otherwise <code class="computeroutput">false</code>. </p></td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>Nothing. </td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">const</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_info</span> <span class="special">&amp;</span> <a name="doxygen.reference_section_of_boost_any.classboost_1_1anys_1_1unique__any_1a85664c4fb919af6df4f400ea69a503c7"></a><span class="identifier">type</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>
Useful for querying against types known either at compile time or only at runtime. </p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>the <code class="computeroutput">typeid</code> of the contained value if instance is non-empty, otherwise <code class="computeroutput">typeid(void)</code>.</p></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2001 Kevlin Henney<br>Copyright © 2013-2025 Antony Polukhin<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="structboost_1_1anys_1_1in__place__type__t.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference_section_of_boost_any.html#doxygen.reference_section_of_boost_any.unique__any_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="unique__any_8hpp_1a082a5eb21c66fc9e1273adfe582943a9.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
